using UnityEngine;

namespace UnityX
{
    [DisallowMultipleComponent]
    [AddComponentMenu("Animation/Rotate Simple")]
    public class RotateSimple : MonoBehaviour
    {
        public enum Axis
        {
            X,
            Y,
            Z,
        }
        public Axis axis = Axis.Y;
        public float speed = 180;
        protected void Update()
        {
            float st = 0.016f;
            if (Time.deltaTime < 0.16f)
            {
                st = Time.deltaTime;
            }
            switch (axis)
            {
                case Axis.X:
                    transform.Rotate(speed * st, 0, 0);
                    break;
                case Axis.Y:
                    transform.Rotate(0, speed * st, 0);
                    break;
                case Axis.Z:
                    transform.Rotate(0, 0, speed * st);
                    break;
            }
        }
    }
}